﻿/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is tyzoh.jp code.
 *
 * The Initial Developer of the Original Code is Kazutaka Kurihara.
 * Portions created by the Initial Developer are Copyright (C) 2007
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using Qurihara;
using Microsoft.Ink;

namespace Qurihara
{
	/// <summary>
	/// UnDo,ReDo,オブジェクトのセーブとロードなどを実現するためのEvent概念の実装。
	/// </summary>

	interface IEvent // イベント共通のインタフェース。あとでクラスに変更するかも。
	{
		void Do();
		void UnDo();
		string getName();
		long TimeStamp
		{
			get;
			set;
		}
		Slide.EVENT Type
		{
				get;
		}
	}
// *********************
	public abstract class ObjectEvent : IEvent  // オブジェクトにまつわるイベントの抽象クラス。
	{
		public abstract void Do();
		public abstract void UnDo();
		public abstract string getName();

		private long timeStamp = 0;
		public long TimeStamp
		{
			get
			{
				return timeStamp;
			}
			set
			{
				timeStamp = value;
			}
		}
		public abstract Slide.EVENT Type{get;}

		public FigureElement figureElement=null;
		protected FigureElementList figureElementList = null;

		public ObjectEvent(FigureElementList fel)
		{
			figureElementList = fel;
		}
		
		protected bool setElementFromID(int ID)
		{
			figureElement = (FigureElement)figureElementList[ID];
			if (figureElement == null ) return false;
			else return true;
		}
		protected FigureElement getElementFromID(int ID)
		{
			if(ID < 0 || ID >= figureElementList.Count) return null;
			return (FigureElement)figureElementList[ID]; 
		}

		public int getID()
		{
			return figureElementList.IndexOf(figureElement);
		}
		
	}

	// ********************
	public abstract class GroupEvent : IEvent  // イベントの集合を扱う
	{
		public void Do(){}
		public void UnDo(){}
		public abstract string getName();

		private long timeStamp = 0;
		public long TimeStamp
		{
			get
			{
				return timeStamp;
			}
			set
			{
				timeStamp = value;
			}
		}
		public abstract Slide.EVENT Type{get;}			
	}
	public class GroupStartEvent : GroupEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.GROUP_START;}
		}
		public override string getName()
		{
			string s = "group start";
			return s;
		}
	}
	public class GroupEndEvent : GroupEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.GROUP_END;}
		}
		public override string getName()
		{
			string s = "group end";
			return s;
		}
	}

	// *********************
	public class MoveObjectEvent : ObjectEvent
	{
		public int X,Y;
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.MOVE_OBJECT;}
		}

		public MoveObjectEvent(FigureElementList fel, int ID,int addx,int addy) :base(fel)
		{
			setElementFromID(ID);
			X = addx;
			Y = addy;
		}

		public override void Do()
		{
			figureElement.moveRerative(X,Y);
		}
		public override void UnDo()
		{
			figureElement.moveRerative(-X,-Y);
		}
		public override string getName()
		{
			string s = "move(" + X + ", " + Y + ")";
			return s;
		}
	}
	// *********************
	public class ResizeObjectEvent : ObjectEvent
	{
		public int addX,addY,addW,addH;
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.RESIZE_OBJECT;}
		}

		public ResizeObjectEvent(FigureElementList fel, int ID,int x,int y,int w,int h) :base(fel)
		{
			setElementFromID(ID);
			addX = x;
			addY = y;
			addW = w;
			addH = h;
		}

		public override void Do()
		{
			figureElement.Resize(addX,addY,addW,addH);
		}
		public override void UnDo()
		{
			figureElement.Resize(-addX,-addY,-addW,-addH);
		}
		public override string getName()
		{
			string s = "resize(" + addX + ", " + addY + ", " + addW + ", " + addH + ")";
			return s;
		}
	}
	// *********************
	public abstract class CreateObjectEvent : ObjectEvent
	{

		public CreateObjectEvent(FigureElementList fel) :base(fel)
		{
		}

		//オブジェクトのコピーを実装するために作られた。
		public CreateObjectEvent(FigureElementList fel,FigureElement fe) :base(fel)
		{
			figureElement = fe;
		}

		public override void Do()
		{
			figureElementList.Add(figureElement);
			figureElement.Invalidate();
		}
		public override void UnDo()
		{
			figureElementList.Remove(figureElement);
			figureElement.Invalidate();
		}
	}
	// *********************
	public class EraseObjectEvent : ObjectEvent
	{

		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.ERASE_OBJECT;}
		}

		public EraseObjectEvent(FigureElementList fel) : base(fel)
		{} // サブクラスでつかう

		public EraseObjectEvent(FigureElementList fel,int ID) : base(fel)
		{
			setElementFromID(ID);
		}
		public override void Do()
		{
			figureElementList.Remove(figureElement);
			figureElement.Invalidate();
		}
		public override void UnDo()
		{
			figureElementList.Add(figureElement);
			figureElement.Invalidate();
		}
		public override string getName()
		{
			string s = "Erase object";
			return s;
		}
	}

	// ********************
	public class CreateRectangleEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_RECTANGLE;}
		}

		public CreateRectangleEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Color fc,Color oc,int ow) :base(fel)
		{
			figureElement = new RectangleElement(parentCont,prio,r,fc,oc,ow);
		}
		public CreateRectangleEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}
		public override string getName()
		{
			string s = "create Rectangle object";
			return s;
		}

	}
	public class CreateEllipseEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_ELLIPSE;}
		}

		public CreateEllipseEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Color fc,Color oc,int ow) :base(fel)
		{
			figureElement = new EllipseElement(parentCont,prio,r,fc,oc,ow);
		}
		public CreateEllipseEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}

		public override string getName()
		{
			string s = "create Ellipse object";
			return s;
		}

	}
	public class CreateTextEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_TEXT;}
		}

		public CreateTextEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,string t,Color c,Font f) :base(fel)
		{
			figureElement = new TextElement(parentCont,prio,r,t,c,f);
		}
		public CreateTextEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}
		public override string getName()
		{
			string s = "create text object ";
			return s;
		}

	}
	public class CreateBitmapEvent : CreateObjectEvent
	{
		public string fileName = null;
		//public Bitmap bitmap = null;
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_BITMAP;}
		}

		public CreateBitmapEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Bitmap bm) :base(fel)
		{
			//bitmap = bm;
			figureElement = new BitmapElement(parentCont,prio,r,bm);
		}
		public CreateBitmapEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,string bmFile) :base(fel)
		{
			fileName = bmFile;
			Bitmap bitmap = new Bitmap(bmFile);
			float aspect = (float)bitmap.Width/bitmap.Height;
			//画像のアスペクト比は保存。高さにあわせる。
			r.Width = (int)(r.Height * aspect);

            string mhs = "";
            int mh;
            if (QBasic.Util.GetStringProperty("Base.MaxBitmapWidth", ref mhs)){
                if (int.TryParse(mhs,out mh)){
                    if (!ImageAnimator.CanAnimate(bitmap))
                    {
                        bitmap = new Bitmap(bitmap, new Size(mh, (int)(mh / aspect)));
                    }
                }
            }

			figureElement = new BitmapElement(parentCont,prio,r,bitmap);
		}
		public CreateBitmapEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}
		
		public override string getName()
		{
			string s = "create bitmap object ";
			return s;
		}

	}
	public class CreateScratchEvent : CreateBitmapEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_SCRATCH;}
		}

		public CreateScratchEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Bitmap bm) :base(fel,parentCont,prio,r,bm)
		{
			//bitmap = bm;
			figureElement = new ScratchElement(parentCont,prio,r,bm);
		}
		public CreateScratchEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,string bmFile) :base(fel,parentCont,prio,r,bmFile)
		{
			//暫定的にBitmapElementからコピーしてきた。
			fileName = bmFile;
			Bitmap bm = new Bitmap(bmFile);
			float aspect = (float)bm.Width/bm.Height;
			//画像のアスペクト比は保存。高さにあわせる。
			r.Width = (int)(r.Height * aspect);

			figureElement = new ScratchElement(parentCont,prio,r,bm);

		}
		public CreateScratchEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}
		
		public override string getName()
		{
			string s = "create scratch object ";
			return s;
		}

	}

	public class CreateInkEvent : CreateObjectEvent
	{ // 作成時はBitmapElementをつくり、保存時にBitmapEventに置き換える。
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_INK;}
		}

		public CreateInkEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Bitmap bm) :base(fel)
		{
			figureElement = new BitmapElement(parentCont,prio,r,bm);
		}
		public CreateInkEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Bitmap bm,bool isRehearsal) :base(fel)
		{ // for Rehearsal mode
			figureElement = new ScratchElement(parentCont,prio,r,bm);
		}
		public CreateInkEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}// 使うかな？
		
		public override string getName()
		{
			string s = "create ink object ";
			return s;
		}

	}
	public class CreateArrowEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_ARROW;}
		}

		public CreateArrowEvent(FigureElementList fel,Control parentCont,int prio,int fromID,int towardID,Color c,System.Drawing.Drawing2D.DashStyle ds) :base(fel)
		{
			FigureElement from = getElementFromID(fromID);
			FigureElement toward = getElementFromID(towardID);
			figureElement = new ArrowElement(parentCont,prio,from,toward,c,ds);
		}
		public CreateArrowEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}// 使うかな

		public override string getName()
		{
			string s = "create bitmap object ";
			return s;
		}

		public void getEdgesID(ref int from,ref int toward)
		{
			from = figureElementList.IndexOf(((ArrowElement)figureElement).fromElement);
			toward = figureElementList.IndexOf(((ArrowElement)figureElement).towardElement);
		}
	}
	public class CreateLineEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_LINE;}
		}

		public CreateLineEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,int sx,int sy,int ex,int ey,Color c,System.Drawing.Drawing2D.DashStyle ds) :base(fel)
		{
			figureElement = new LineElement(parentCont,prio,r,sx,sy,ex,ey,c,ds);
		}
		public CreateLineEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}
		
		public override string getName()
		{
			string s = "create line object ";
			return s;
		}

	}
	public class CreateExternalEvent : CreateObjectEvent
	{
        //public string fileName = null;
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_EXTERNAL;}
		}

		public CreateExternalEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,string File) :base(fel)
		{
            //fileName = File;
			figureElement = new ExternalElement(parentCont,prio,r,File);
		}
		public CreateExternalEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{
			if (fe is ExternalElement)
			{
                //fileName = ((ExternalElement)fe).filename;
			}
			else
			{
                //fileName = "--Element Error--";
			}

		}
		
		public override string getName()
		{
			string s = "create External object ";
			return s;
		}

	}

    public class CreateLinkImageEvent : CreateObjectEvent
    {
        //public string fileName = null;
        protected string hash;
        //public string Hash
        //{
        //    get { return hash; }
        //}
        protected int refleshRate;
        //public int RefleshRate
        //{
        //    get { return refleshRate; }
        //}
        protected bool persist;
        //public bool Persist
        //{
        //    get { return persist; }
        //}

        public override Slide.EVENT Type
        {
            get { return Slide.EVENT.CREATE_LINK_IMAGE; }
        }

        public CreateLinkImageEvent(FigureElementList fel, Control parentCont, int prio, Rectangle r, string File, string hash, int reflesh, bool persist)
            : base(fel)
        {
            //fileName = File;
            //this.hash = hash;
            //this.refleshRate = reflesh;
            //this.persist = persist;
            figureElement = new LinkImageElement(parentCont, prio, r, File, hash, reflesh, persist);
        }
        public CreateLinkImageEvent(FigureElementList fel, FigureElement fe)
            : base(fel, fe)
        {
            if (fe is LinkImageElement)
            {
                //fileName = ((ExternalElement)fe).filename;
                //hash = ((LinkImageElement)fe).Hash;
                //refleshRate = ((LinkImageElement)fe).RefleshRate;
                //persist = ((LinkImageElement)fe).Persist;
            }
            else
            {
                //fileName = "--Element Error--";
                //hash = "";
                //refleshRate = 0;
                //persist = false;
            }

        }

        public override string getName()
        {
            string s = "create LinkImage object ";
            return s;
        }

    }

/*
	public class CreateRectangleAndTextEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_RECTANGLE_AND_TEXT;} 
		}

		public CreateRectangleAndTextEvent(FigureElementList fel,int prio,Rectangle r,Color wc,string s,Color tc,Font f) :base(fel)
		{
			figureElement = new RectangleAndTextElement(prio,r,wc,s,tc,f);
		}
		public CreateRectangleAndTextEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}

		public override string getName()
		{
			string s = "create RectangleAndText object";
			return s;
		}

	}
	*/
	public class CreateElementGroupEvent : CreateObjectEvent
	{
		protected FigureElementList groupElementList= null;
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_ELEMENT_GROUP;}
		}
/*
		public CreateElementGroupEvent(FigureElementList fel,Rectangle r,FigureElementList groupfel) :base(fel)
		{
			//BoundingBoxもらうバージョン
			groupElementList = new FigureElementList();
			groupElementList.Add(groupfel);
			figureElement = new ElementGroupElement(r,groupElementList);
		}
*/
		public CreateElementGroupEvent(FigureElementList fel,Control parentCont,int prio,FigureElementList groupfel) :base(fel)
		{
			//BoundingBoxつくるバージョン
			Rectangle r = new Rectangle(); 
			groupfel.GetBoundingBox(ref r);
			groupElementList = new FigureElementList();
			groupElementList.Add(groupfel);
			figureElement = new ElementGroupElement(parentCont,prio,r,groupElementList);
		}
		public CreateElementGroupEvent(FigureElementList fel,Control parentCont,int prio,ArrayList indexList) :base(fel)
		{
			//BoundingBoxつくるバージョン ファイルから読み込む用
			groupElementList = new FigureElementList();
			IEnumerator enume = indexList.GetEnumerator();
			FigureElement addElement;
			while(enume.MoveNext())
			{
				addElement = getElementFromID((int)enume.Current);
				if (addElement != null)	groupElementList.Add(addElement); // 一応あるか確認。
			}
			Rectangle r = new Rectangle(); 
			groupElementList.GetBoundingBox(ref r);

			figureElement = new ElementGroupElement(parentCont,prio,r,groupElementList);
		}
		public CreateElementGroupEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{
			if (fe is ElementGroupElement)
			{
				groupElementList = ((ElementGroupElement)fe).groupElementList;
			}
			else
			{
				groupElementList = new FigureElementList();
			}
		
		}
		
		public override string getName()
		{
			string s = "create Element Group object ";
			return s;
		}
		public override void Do()
		{
			groupElementList.Findable = false;
			figureElementList.Add(figureElement);
		}
		public override void UnDo()
		{
			figureElementList.Remove(figureElement);
			groupElementList.Findable = true;
		}
		public void getGroupElementIDs(ref ArrayList outlist )
		{
			int index;
			outlist.Clear();
			IEnumerator enume = groupElementList.GetEnumerator();
			while(enume.MoveNext())
			{
				index = figureElementList.IndexOf(enume.Current);
				if (index != -1)
				{
					outlist.Add(index);
				}
			}
		}

	}
	// ********
	public class CreateRecogGroupEvent : CreateObjectEvent
	{// ElementGroupEventにとても似ている。
		protected FigureElementList groupElementList= null;
		protected FigureElementList recogGroupElementList = null;
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_RECOG_GROUP;}
		}
		public CreateRecogGroupEvent(FigureElementList fel,Control parentCont,int prio,FigureElementList groupfel,FigureElementList rgroupfel) :base(fel)
		{
			//BoundingBoxつくるバージョン
			Rectangle r = new Rectangle(); 
			groupfel.GetBoundingBox(ref r);
			groupElementList = new FigureElementList();
			groupElementList.Add(groupfel);
			recogGroupElementList = new FigureElementList();
			recogGroupElementList.Add(rgroupfel);
			figureElement = new RecogGroupElement(parentCont,prio,r,groupElementList,recogGroupElementList);
		}
		public CreateRecogGroupEvent(FigureElementList fel,Control parentCont,int prio,ArrayList indexList,ArrayList rIndexList) :base(fel)
		{
			//BoundingBoxつくるバージョン ファイルから読み込む用
			groupElementList = new FigureElementList();
			IEnumerator enume = indexList.GetEnumerator();
			FigureElement addElement;
			while(enume.MoveNext())
			{
				addElement = getElementFromID((int)enume.Current);
				if (addElement != null)	groupElementList.Add(addElement); // 一応あるか確認。
			}
			Rectangle r = new Rectangle(); 
			groupElementList.GetBoundingBox(ref r);

			recogGroupElementList = new FigureElementList();
			enume = rIndexList.GetEnumerator();
			while(enume.MoveNext())
			{
				addElement = getElementFromID((int)enume.Current);
				if (addElement != null)	recogGroupElementList.Add(addElement); // 一応あるか確認。
			}

			figureElement = new RecogGroupElement(parentCont,prio,r,groupElementList,recogGroupElementList);
		}
		public CreateRecogGroupEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{
			if (fe is RecogGroupElement)
			{
				groupElementList = ((RecogGroupElement)fe).groupElementList;
				recogGroupElementList = ((RecogGroupElement)fe).recogGroupElementList;
			}
			else
			{
				groupElementList = new FigureElementList();
				recogGroupElementList = new FigureElementList();
			}
		
		}
		public override string getName()
		{
			string s = "create Recog Group object ";
			return s;
		}
		public override void Do()
		{
			groupElementList.Findable = false;
			figureElementList.Add(figureElement);
			recogGroupElementList.Findable = false;
			//figureElementList.Remove(recogGroupElementList);
			recogGroupElementList.Visible = false;
		}
		public override void UnDo()
		{
			figureElementList.Remove(figureElement);
			groupElementList.Findable = true;
			//figureElementList.Add(recogGroupElementList);
			recogGroupElementList.Visible = true;
			recogGroupElementList.Findable = true;
		}
		public void getGroupElementIDs(ref ArrayList outlist )
		{
			int index;
			outlist.Clear();
			IEnumerator enume = groupElementList.GetEnumerator();
			while(enume.MoveNext())
			{
				index = figureElementList.IndexOf(enume.Current);
				if (index != -1)
				{
					outlist.Add(index);
				}
			}
		}
		public void getRecogGroupElementIDs(ref ArrayList outlist )
		{
			int index;
			outlist.Clear();
			IEnumerator enume = recogGroupElementList.GetEnumerator();
			while(enume.MoveNext())
			{
				index = figureElementList.IndexOf(enume.Current);
				if (index != -1)
				{
					outlist.Add(index);
				}
			}
		}
	}
	// *********************
	public class ReleaseElementGroupEvent : EraseObjectEvent
	{

		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.RELEASE_ELEMENT_GROUP;}
		}

		public ReleaseElementGroupEvent(FigureElementList fel,ElementGroupElement ege) :base(fel)
		{
			this.figureElement = ege;
		}

		public ReleaseElementGroupEvent(FigureElementList fel,int ID) : base(fel,ID)
		{
		}

		public override void Do()
		{
			((ElementGroupElement)figureElement).groupElementList.Findable = true;
			figureElementList.Remove(figureElement);
		}
		public override void UnDo()
		{
			figureElementList.Add(figureElement);
			((ElementGroupElement)figureElement).groupElementList.Findable = false;
		}
		public override string getName()
		{
			string s = "Release Element Group object";
			return s;
		}
	}
	// *********************
	public class RecognizeRecogGroupEvent : EraseObjectEvent
	{

		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.RECOG_RECOG_GROUP;}
		}

		public RecognizeRecogGroupEvent(FigureElementList fel,RecogGroupElement ege) :base(fel)
		{
			this.figureElement = ege;
		}

		public RecognizeRecogGroupEvent(FigureElementList fel,int ID) : base(fel,ID)
		{
//			setElementFromID(ID);
		}

		public override void Do()
		{
			RecogGroupElement rge = (RecogGroupElement)figureElement;
			rge.groupElementList.Findable = true;
			figureElementList.Remove(figureElement);
			figureElementList.Remove(rge.groupElementList);
			//figureElementList.Add(rge.recogGroupElementList);
			rge.recogGroupElementList.Visible = true;
			rge.recogGroupElementList.Findable = true;
		}
		public override void UnDo()
		{
			RecogGroupElement rge = (RecogGroupElement)figureElement;
			figureElementList.Add(figureElement);
			rge.groupElementList.Findable = false;
			figureElementList.Add(rge.groupElementList);
			rge.recogGroupElementList.Findable = false;
			//figureElementList.Remove(rge.recogGroupElementList);
			rge.recogGroupElementList.Visible = false;
		}
		public override string getName()
		{
			string s = "Recognize RecogGroup object";
			return s;
		}
	}
	// **********************
	public class CreateStrokeEvent : CreateObjectEvent
	{
		public override Slide.EVENT Type
		{
			get{ return Slide.EVENT.CREATE_STROKE;}
		}

		public CreateStrokeEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,Stroke s) :base(fel)
		{
			figureElement = new StrokeElement(parentCont,prio,r,s);
		}
		public CreateStrokeEvent(FigureElementList fel,Control parentCont,int prio,Rectangle r,int id) :base(fel)
		{
			//Stroke s = QBasic.InkUtil.GetStrokeFromID(StrokeElement.inkCollector.Ink,id);
			//figureElement = new StrokeElement(parentCont,prio,r,s);
			figureElement = new StrokeElement(parentCont,prio,r,id);
		}
		public CreateStrokeEvent(FigureElementList fel,FigureElement fe) : base(fel,fe)
		{}
		
		public override string getName()
		{
			string s = "create stroke object ";
			return s;
		}

	}



}
